package com.dome.order.config;

import com.dome.base.interceptor.UserInterceptor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebServerMvcConfigurerAdapter implements WebMvcConfigurer {
    @Value("${security.oauth2.jwt.signingKey}")
    private String signingKey;

    @Bean
    public UserInterceptor userInterceptor() {
        return new UserInterceptor(signingKey);
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {

        registry.addInterceptor(userInterceptor());
    }

  /*  @Bean
    public Feign.Builder feignBuilder() {
        return Feign.builder().requestInterceptor(new CoreFeignRequestInterceptor(signingKey));
    }*/



}
